//
//  EffectView.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/8/6.
//  Copyright © 2018年 四川中农. All rights reserved.
//

import UIKit

typealias TouchBlock = ()->Void

class EffectView: UIView {

    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    
    var hidenClosure:TouchBlock!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
//        self.backgroundColor = UIColor.nav_color
        let effect = UIBlurEffect.init(style: .light)
        let visusView = UIVisualEffectView.init(effect: effect)
        visusView.frame = self.bounds
        self.addSubview(visusView)
        
        let tap = UITapGestureRecognizer.init(target: self, action: #selector(viweTap))
        self.addGestureRecognizer(tap)
    }
    
    @objc func viweTap(){
        if self.hidenClosure != nil {
            self.hidenClosure()
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
